package cn.itcast.service.impl;

import cn.itcast.dao.AccountDao;
import cn.itcast.domain.Account;
import cn.itcast.service.AccountService;
import lombok.Data;

import java.util.List;

public class AccountServiceImpl implements AccountService {
    private AccountDao accountDao;

    @Override
    public List<Account> findAll() throws Exception {
        return accountDao.findAll();
    }

    @Override
    public int delete(Integer id) throws Exception {
        int i = accountDao.delete(id);
        return i;
    }

    @Override
    public int add(Account account) throws Exception {
        int add = accountDao.add(account);
        return add;
    }

    @Override
    public int update(Integer id, String name, Integer money) {
        int update = accountDao.update(id, name, money);
        return update;
    }

    public void setAccountDao(AccountDao accountDao) {
        this.accountDao = accountDao;
    }
}
